# PowerShell script for compiling Snake Game on Windows
# Usage: .\compile.ps1

Write-Host "Compiling Snake Game for Windows..." -ForegroundColor Green

# Check if g++ is available
$gppAvailable = Get-Command "g++" -ErrorAction SilentlyContinue

if (-not $gppAvailable) {
    Write-Host "Error: g++ compiler not found!" -ForegroundColor Red
    Write-Host "Please install MinGW-w64 or another C++ compiler for Windows" -ForegroundColor Yellow
    exit 1
}

# Compile the game
g++ -std=c++11 main.cpp snake.cpp -o snake_game.exe

if ($LASTEXITCODE -eq 0) {
    Write-Host "Compilation successful!" -ForegroundColor Green
    Write-Host "Executable: snake_game.exe" -ForegroundColor Cyan
    Write-Host "Starting Snake Game..." -ForegroundColor Green
    .\snake_game.exe
} else {
    Write-Host "Compilation failed!" -ForegroundColor Red
    exit 1
}